package com.adv.ems.model.vo;

import cn.hutool.core.date.DateUtil;
import com.adv.ems.db.entity.EnergyReportTemplateDO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;
import java.util.List;

@Data
public class ReportTemplateVO {
    private List<Info> list;


    @EqualsAndHashCode(callSuper = true)
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Info extends EnergyReportTemplateDO {
        private String createTimeDesc;
        private String updateTimeDesc;

        public Info(EnergyReportTemplateDO energyReportDO) {
            BeanUtils.copyProperties(energyReportDO, this);
            this.setData(null);
            this.createTimeDesc = DateUtil.formatDateTime(energyReportDO.getCreateTime());
            this.updateTimeDesc = DateUtil.formatDateTime(energyReportDO.getUpdateTime());
        }
    }
}
